Skip to main content
Glama

get comments

Retrieve comments from TabNews content by specifying the username and slug, enabling easy access to user discussions and feedback on articles.

Instructions

get comments from a content on tabnews api

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesThe slug to get the content
usernameYesThe username to get the content

Implementation Reference

  • The async handler function that implements the core logic of the 'get comments' tool. It calls getContentChildren API with username and slug, formats the result as JSON text, and returns it in MCP response format. Handles errors by throwing descriptive messages.
    handler: async (params: GetContentParams): Promise<McpResponse> => { try { const result = await getContentChildren({ username: params.username, slug: params.slug, }); const content: McpTextContent = { type: "text", text: `Comments:\n\n${JSON.stringify(result, null, 2)}`, }; return { content: [content], }; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get comments: ${error.message}`); } else { throw new Error("Failed to get comments"); } } },
  • Zod schema defining the input parameters for the tool: username (string) and slug (string).
    parameters: { username: z.string().describe("The username to get the content"), slug: z.string().describe("The slug to get the content"), },
  • src/index.ts:52-57 (registration)
    Registers the 'get comments' tool (imported as getContentChildrenTool) with the MCP server by passing its name, description, parameters schema, and handler function.
    server.tool( getContentChildrenTool.name, getContentChildrenTool.description, getContentChildrenTool.parameters, getContentChildrenTool.handler );
  • src/index.ts:9-9 (registration)
    Import of the getContentChildrenTool from src/tools/status.ts for registration.
    getContentChildrenTool,
  • Full tool object definition and export, including name 'get comments', description, parameters schema, and handler.
    export const getContentChildrenTool = { name: "get comments", description: "get comments from a content on tabnews api", parameters: { username: z.string().describe("The username to get the content"), slug: z.string().describe("The slug to get the content"), }, handler: async (params: GetContentParams): Promise<McpResponse> => { try { const result = await getContentChildren({ username: params.username, slug: params.slug, }); const content: McpTextContent = { type: "text", text: `Comments:\n\n${JSON.stringify(result, null, 2)}`, }; return { content: [content], }; } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get comments: ${error.message}`); } else { throw new Error("Failed to get comments"); } } }, };

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/renant/mcp-tabnews'

If you have feedback or need assistance with the MCP directory API, please join our Discord server